Day 9 - Fields

77

Solution

There are several ways to achieve this result. Two possible ones are

$ cat simple.log | cut -d ":" -f 2-4 | cut -d "]" -f 1

10:05:03

10:05:43

10:05:47

[...]

and

$ cat simple.log | cut -d "]" -f 1 | cut -d ":" -f 2-4

10:05:03

10:05:43

10:05:47

In the first one I first cut using the colon and then we remove the part separated by a closing bracket,

while in the second one I do the opposite, first selecting the first column separated by a closing

bracket and then removing the first part separated by colon.

Go back to the exercise